package com.defangit.award.extend.repeat_by_share;

import com.defangit.award.domain.WinningInfo;
import com.defangit.award.extend.point.AwardListener;
import com.defangit.award.extend.repeat_by_share.orm.SpreadService;

import java.util.List;

/**
 * Created by zhangfagen on 2019/1/4.
 */
public class RBSAwardListener extends AwardListener {
    @Override
    public boolean validateWinningInfoBeforeAward(int awardId, String openid, List<WinningInfo> infos) {
        if(infos.size()<3){
            return true;
        }else{
            long cnt=new SpreadService().findAll().award(awardId).user(openid).count();
            return infos.size()<cnt;
        }
    }
}
